(deftemplate Zbor (slot plecare) (slot sosire) (slot distanta))

(assert (Zbor (plecare New_York) (sosire Chicago) (distanta 900)))
(assert (Zbor (plecare Chicago) (sosire Denver) (distanta 1000)))
(assert (Zbor (plecare New_York) (sosire Toronto) (distanta 500)))
(assert (Zbor (plecare New_York) (sosire Denver) (distanta 1800)))
(assert (Zbor (plecare Toronto) (sosire LA) (distanta 2500)))
(assert (Zbor (plecare Toronto) (sosire Chicago) (distanta 500)))
(assert (Zbor (plecare Toronto) (sosire Calgary) (distanta 1700)))
(assert (Zbor (plecare Denver) (sosire Urbana) (distanta 1000)))
(assert (Zbor (plecare Denver) (sosire Huston) (distanta 1000)))
(assert (Zbor (plecare Huston) (sosire LA) (distanta 1500)))
(assert (Zbor (plecare Denver) (sosire LA) (distanta 1000)))

(defrule NY
  
    (Zbor (plecare New_York) (sosire ?sosire1) (distanta ?distanta1))
    =>
   (printout t "Zborurile care pleaca din New York la: " ?sosire1 " distanta: " ?distanta1 crlf)   
)
(printout t "Zborurile cu distanta cuprinsa intre 800 si 2200") 
(defrule dist
  (Zbor (plecare ?p)  (sosire ?s)(distanta ?X) )
    (test (and(> ?X 800 )  (< ?X 2200)))
    =>
 
    (printout t crlf "plecare : " ?p " sosire: " ?s " distanta: " ?X crlf) 
    )

(run)
